<template>
  <div>
    <div class="editor" ref="editor"></div>
  </div>
</template>
<script>
import E from "wangeditor";
export default {
  data() {
    return {};
  },
  mounted() {
    this.createE();
  },
  methods: {
    createE() {
      let editor = new E(this.$refs.editor);
      editor.config.height = 400;
      // 传递内容
      editor.config.onchange = (html) => {
        this.$emit("change", html);
      };
      // 挂载highlight插件
      editor.create();
    },
  },
};
</script>
<style scoped>
.editor {
  margin-top: 20px;
}
</style>
